﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NExt.Core.Model.Base
{
    public class NamedFunction: IScript
    {
        private const string FUNCTION_BODY_SEPERATOR = "\r\n";

        public NamedFunction(string name, string parameterString, string body)
        {
            this.name = name;
            this.body = body;
            this.parameterString = parameterString;
        }

        public string name { get; set; }
        public string body { get; set; }
        public string parameterString { get; set; }

        public string text
        {
            get
            {
                string function = string.Format("{0} = function({1}){{{2}{3}{2}}};", name, parameterString, FUNCTION_BODY_SEPERATOR, body);
                return function;
            }
        }
    }
}
